/**
 * Created by hetanhong on 2014/9/4.
 * 展示会议通知，会议纪要，会议方案，会议呈报详细信息，可以向后台提交信息
 */
(function () {
    var huiyi = function (config) {
        this._config = config;
        this._type = this.getConfig("type");//流程总类型
        this._id = this.getConfig("id");//公文id
        this._taskId = this.getConfig("taskId");//任务id
        this._businessType = this.getConfig("businessType");//流程子类型
        this._buttonFlag = this.getConfig("buttonFlag") || false;//是否显示操作按钮
        this._taskName = this.getConfig("taskName");//流程名称
        this._url = this.getConfig("url") || "";//外出报备
        this._format = d3.time.format("%Y -%_m -%_d");//格式化时间
        this._from = this.getConfig("from");
        this._screenindex = this.getConfig("screenindex") || 3;
    };
    if (typeof (Clickmed) === "undefined") {
        Clickmed = {};
    }
    Clickmed.huiyi = huiyi;
    huiyi.prototype.businessType = function () {
        var me = this;

        if (me._businessType == "0027" || me._businessType == "0028") {
            me._type = "meetContent"
        }
        if (me._businessType == "0020" || me._businessType == "0030" || me._businessType == "0031") {
            me._type = "meetPlan"
        }
        if (me._businessType == "0021") {
            me._type = "meetTell"
        }
        if (me._businessType == "0023") {
            me._type = "meetMark"
        }

    }
    huiyi.prototype.init = function () {
        var me = this;
        console.log(me);
        me.businessType();
        var url = serverURL + "cmcp/phone/doGetLanguages";
        PostCP(url, null, function (dat) {
            me.languages = dat;
        });
        if (me._businessType == "0025") {
            me.wcbb();  // 外出报备
            return;
        }

        var url = serverURL + "cmcp/phone/meet/getDetailInfo";
        window.plugins.getIntent.show(["OA", "正在获取数据."]);
        var self = {
            buttonFlag: me._buttonFlag,
            type: me._type,
            id: me._id
        };
        console.log(self); // 会议其他类型详细数据
        PostCP(url, self, function (dat) {
            window.plugins.getIntent.hide();
            console.log(dat);
            if (!dat) {

                Alert("获取数据失败..");
                return;
            }
            me.dat = dat;
            // 查询还好审批
            if (!me._buttonFlag) {
                var url = serverURL + "cmcp/phone/getApprovalUserInfo";
                var self = {
                    taskId: me._taskId
                };
                PostCP(url, self, function (dat) {
                    console.log(dat);
                    me.button = dat;
                    // modify 2014 -12-29获取当前userTask
                    if (dat["userTask"]) {
                        me._userTask = dat["userTask"];
                    }
                    // modify 2014 -12-29获取当前userTask
                    me.meet();
                    me.showButton();
                }, function () {
                    Alert("获取数据失败");
                });
            }
            else {
                me.meet(false);
                me.showButton();
            }

        }, function () {
            window.plugins.getIntent.hide();
            Alert("获取数据失败");
        });

    };
    huiyi.prototype.meet = function (flag) {
        var me = this;
        var render = this._config.render || d3.select("body");
        var d1 = this._config.body || d3.select("body");
        var width = this.width;
        var scrol = d1.append("div").classed("scrol", true).style({
            width: "100%",
            height: "100%",
            position: "absolute",
            background: "#fff",
            left: "0px",
            top: "0px",
            "z-index": 99,
            top: "0px"
        }).attr("id", "scrol");

        var warp = scrol.append("div").classed("dt_warp", true).style({
            position: "relative"
        });
        var datong_header = warp.append("div").classed("datong_header", true);

        var go_back = datong_header.append("div").classed("go_back", true);
        go_back.html("<i><img src =../../common/page/images/go_back_ico.png width =16 height=auto></i>返回");
        go_back.on(touch_s, function () {
            $(this).css("background-color", "#005ebf");
        });
        go_back.on(touch_e, function () {
            $(this).css("background-color", "");


            setTimeout(function () {
                d3.selectAll("#scrol").remove();
                Android.back = TempFunction.back;
            }, Transiacion);

        });
        function back1() {

            setTimeout(function () {
                d3.selectAll("#scrol").remove();
            }, Transiacion);
            Android.back = TempFunction.back;
        }

        // Android返回键动作
        Android.back = TempFunction.back1 = back1;
        datong_header.append("h1").html(me._taskName || "");

        if (!flag)
            me.meetContent();
        return;
        /*
         if (me._type == "meetContent") {
         me.meetContent()
         }
         else if (me._type == "meetPlan") {
         me.meetPlan();
         }
         else if (me._type == "meetTell") {
         me.meetTell();
         }
         else if (me._type == "meetMark") {
         me.meetMark();
         }*/
    };
    //获取 url里的type
    huiyi.prototype.getType = function (Type) {
        var me = this;
        var url = me._url;
        if (url.split("?").length > 1) {
            var prame = url.split("?")[1];
            var prames = prame.split("&");
            for (var i = 0; i < prames.length; i++) {
                var targetStep = prames[i].split("=")[0];
                if (targetStep == Type && prames[i].split("=").length > 1) {
                    return prames[i].split("=")[1];
                }
            }
        }

    };
    // 外出报备
    huiyi.prototype.wcbb = function () {
        var me = this;
        me.meet(true);
        var url = serverURL + "cmcp/goutapply/getGoutApply";
        window.plugins.getIntent.show(["OA", "正在获取数据."]);
        var self = {
            id: me._id
        };
        PostCP(url, self, function (dat) {
            if (!dat) {
                Alert("获取数据失败..");
                return
            }
            //console.log("获取外出报备单详情菜单:"+JSON.stringify(dat));
            me.wcbbData = dat;
            var wcURL = me._url;
            var buttonURL = serverURL + "cmcp/goutapply/getGoutApplyBtns";
            var self = {
                type: me.getType("type"),
                targetStep: me.getType("targetStep")
            }
            console.log(self);
            PostCP(buttonURL, self, function (but) {
                //console.log("获取外出报备单按钮:"+JSON.stringify(but))
                me.button = but;
                me.showWcbb();
            }, function () {
            });


        }, function () {
            window.plugins.getIntent.hide();
            Alert("获取数据失败");
        });
    };
    //展示外出报备信息
    huiyi.prototype.showWcbb = function () {
        var me = this;

        var wcbbData = me.wcbbData;
        var warp = d3.select("#scrol .dt_warp");
        var disTant = 100;
        if (me._buttonFlag)
            disTant = 44;
        var scrol_ = warp.append("div").classed("scrol_", true).style({
            width: "100%",
            height: height - disTant + "px",
            postion: "relative",
            overflow: "hidden"
        }).attr("id", "scrol_");
        var datong_con = scrol_.append("div").classed("datong_con datong_con_re", true);
        var datong_con = datong_con.append("div").classed("phone_cotent", true);
        var ul = datong_con.append("ul");
        var li = ul.append("li").classed("b_btm", true).style({
            width: "100%"
        });
        var table = li.append("table").attr("cellpadding", "0").attr('cellspacing', "0").style({
            width: "100%"
        });
        for (var mn in wcbbData) {
            if (!wcbbData[mn])
                continue;
            if (mn == "applyUnit") {
                var tr = table.append("tr");
                tr.append("td").html("<div>填&nbsp;报&nbsp;单&nbsp;位</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn]).classed("extend", true);
            }
            if (mn == "applyDate") {
                var tr = table.append("tr");
                tr.append("td").html("<div>填&nbsp;报&nbsp;时&nbsp;间</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(me._format(new Date(wcbbData[mn]))).classed("extend", true)
            }
            if (mn == "leaveDate") {
                var tr = table.append("tr");
                tr.append("td").html("<div>离&nbsp;开&nbsp;时&nbsp;间</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(me._format(new Date(wcbbData[mn]))).classed("extend", true)
            }
            if (mn == "returnDate") {
                var tr = table.append("tr");
                tr.append("td").html("<div>返&nbsp;回&nbsp;时&nbsp;间</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(me._format(new Date(wcbbData[mn]))).classed("extend", true)
            }
            if (mn == "applyUserName") {
                var tr = table.append("tr");
                tr.append("td").html("<div>姓&nbsp; 名</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn].replace(/\n/g, "<br>")).classed("extend", true);
            }
            if (mn == "applyOrgName") {
                var tr = table.append("tr");
                tr.append("td").html("<div>职&nbsp; 务</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn].replace(/\n/g, "<br>")).classed("extend", true);
            }
            if (mn == "applyPhoneNum") {
                var tr = table.append("tr");
                tr.append("td").html("<div>联&nbsp;系&nbsp;方&nbsp;式</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn].replace(/\n/g, "<br>")).classed("extend", true);
            }
            if (mn == "reason") {
                var tr = table.append("tr");
                tr.append("td").html("<div>外&nbsp;出&nbsp;事&nbsp;由</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn].replace(/\n/g, "<br>")).classed("extend", true);
            }
            if (mn == "goToPlace") {
                var tr = table.append("tr");
                tr.append("td").html("<div>外&nbsp;出&nbsp;地&nbsp;点</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn].replace(/\n/g, "<br>")).classed("extend", true);
            }
            if (mn == "proxyNameOrg") {
                var tr = table.append("tr");
                tr.append("td").html("<div>代&nbsp;理&nbsp;人&nbsp;姓&nbsp;名&nbsp;职&nbsp;务</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn]).classed("extend", true);
            }
            if (mn == "proxyPhoneNum") {
                var tr = table.append("tr");
                tr.append("td").html("<div>代&nbsp;理&nbsp;人&nbsp;联&nbsp;系&nbsp;方&nbsp;式</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn]).classed("extend", true);
            }
            if (mn == "mszOpinion") {
                var tr = table.append("tr");
                tr.append("td").html("<div>秘&nbsp;书&nbsp;长&nbsp;意&nbsp;见</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn].replace(/\n/g, "<br>")).classed("extend", true);
            }
            if (mn == "fszOpinion") {
                var tr = table.append("tr");
                tr.append("td").html("<div>副&nbsp;市&nbsp;长&nbsp;意&nbsp;见</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn].replace(/\n/g, "<br>")).classed("extend", true);
            }
            if (mn == "szOpinion") {
                var tr = table.append("tr");
                tr.append("td").html("<div>市&nbsp;领&nbsp;导&nbsp;意&nbsp;见</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn].replace(/\n/g, "<br>")).classed("extend", true);
            }
            if (mn == "remark") {
                var tr = table.append("tr");
                tr.append("td").html("<div>备&nbsp;注</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn].replace(/\n/g, "<br>")).classed("extend", true);
            }
            if (mn == "contactsName") {
                var tr = table.append("tr");
                tr.append("td").html("<div>报&nbsp;送&nbsp;单&nbsp;位&nbsp;联&nbsp;系&nbsp;人</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn].replace(/\n/g, "<br>")).classed("extend", true);
            }
            if (mn == "contactsPhoneNum") {
                var tr = table.append("tr");
                tr.append("td").html("<div>报&nbsp送&nbsp单&nbsp位&nbsp联&nbsp系&nbsp电&nbsp话</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn].replace(/\n/g, "<br>")).classed("extend", true);
            }
            if (mn == "contactsMBNum") {
                var tr = table.append("tr");
                tr.append("td").html("<div>报&nbsp送&nbsp单&nbsp位&nbsp联&nbsp系&nbsp手&nbsp机</div>").style("width", "25%");
                tr.append("td").style("width", "75%").append("div").html(wcbbData[mn].replace(/\n/g, "<br>")).classed("extend", true);
            }
            $("tr").each(function () {
                var me = d3.select(this);
                me.select("td")[0][0].style.color = "#2875c3";
            });

        }
		/*
         流程跟踪
         */
        if (me._from != "zfwj") {
            var report_title = d3.select(".datong_con_re").append("div").classed("report_title", true).html("流程跟踪");
            report_title.style({
                background: "#f2f2f0",
                color: "#2345e6",
                "border-radius": "10px",
                "margin": "0% 2% 2% 2%"
            })
            report_title.on("click", function () {
                if (Flag)
                    return;
                Flag = true;
                me.openNew();

                setTimeout(function () {
                    Flag = false;
                }, 500);
            });
        }
		
        if (!me._buttonFlag) {
            me.wcButton();
        }
        new iScroll("scrol_", {hScrollbar: false, vScrollbar: false});
    };
    //外出报备操作按钮
    huiyi.prototype.wcButton = function () {
        var me = this;
        var warp = d3.select("#scrol .dt_warp");
        $(".tj_button2 p input").remove();
        var button = warp.append("div").classed("tj_button2", true).classed("qb_btn_bg", true);
        var tj_button = button.append("p").style({
            "text-align": "center"
        });
        for (var i = 0; i < me.button.length; i++) {
            var Action = me.button[i]["btnName"] || "";
            var input = null;
            if (Action.indexOf("退回") > -1) {
                input = tj_button.append("input").classed("btn_back", true)
                    .attr("type", "button")
                    .attr("value", "退 回");
            } else if (Action.indexOf("作废") > -1) {
                input = tj_button.append("input").classed("drop", true)
                    .attr("value", "作 废")
                    .attr("type", "button")
            }
            else if (Action.indexOf("批示") > -1) {
                input = tj_button.append("input").classed("btn_agree", true)
                    .attr("type", "button")
                    .attr("value", Action);
            } else {
                input = tj_button.append("input").classed("other", true)
                    .attr("type", "button")
                    .attr("value", Action);
            }
            $(input.node()).data("Info", me.button[i])//.attr("disabled", "disabled");

        }
        if ($(".tj_button2 p input").length <= 0) {
            $(".tj_button2").remove();
            $("#scrol_").css({
                height: height - 44 + "px"
            });
        }
        if ($(".tj_button2 p input").length <= 2) {
            $(".tj_button2 p input").css({
                width: "40%"
            });
        }
        if ($(".tj_button2 p input").length === 3) {
            $(".tj_button2 p input").css({
                width: "26.1%"
            });
        }
        if ($(".tj_button2 p input").length === 4) {
            $(".tj_button2 p input").css({
                width: "20%"
            });
        }
        me.wcButtonClick();
    };
    // 外出报备 按钮点击事件
    huiyi.prototype.wcButtonClick = function () {
        var me = this;
        $(".tj_button2 p input").on("click", function () {
            if (Flag)
                return;
            Flag = true;
            setTimeout(function () {
                Flag = false;
            }, 500);
            var Info = $(this).data("Info");
            me._Info = Info;
            me.targetStep = Info["targetStep"] || "";
            me.btnParam = Info["btnParam"] || "";
            me.btnCode = Info["btnCode"] || ""
            me.roleCode = Info["roleCode"] || "";
            me.type = Info["type"] || "";
            me.btnRoles = Info["btnRoles"] || "";
            me.btnName = Info["btnName"] || ""
            if (me.targetStep == "fsz" || me.targetStep == "sz" || me.targetStep == "msz") {
                if (me.btnParam == "fsz") {
                    me.nextWithWordAndPerson();
                }
                else {
                    me.nextWithWord(true);
                }

            } else {
                me.nextWithWord(false);
            }

        });
    };
    // 审批 ，需要输入意见，且需要选择下一位
    huiyi.prototype.nextWithWordAndPerson = function () {
        var me = this;
        var d1 = this._config.body || d3.select("body");
        var select = d3.select("body").append("div").classed("select", true).style({
            width: "100%",
            height: "100%",
            background: "#fff",
            position: "absolute",
            left: "0px",
            top: "0px",
            "z-index": 1000,
            "over-follow": "hidden"
        });

        var dt_warp = select.append("div").classed("dt_warp", true);
        var head = dt_warp.append("div").classed("datong_header", true);

        var back = head.append("div").classed("go_back", true);
        back.html("<i><img src =../../common/page/images/go_back_ico.png width =16 height=auto></i>返回");
        back.on(touch_s, function () {
            $(this).css("background-color", "#005ebf");
        });
        // 左上角返回按钮 动作
        back.on(touch_e, function () {
            $(this).css("background-color", "");

            setTimeout(function () {
                select.remove();
                // Android返回键动作更改
                Android.back = TempFunction.back1;
            }, 10);
        });
        var datong_con = dt_warp.append("div").classed("datong_con", true).style({
            height: (height - 44) + "px",
            background: "#fff"
        });
        var ps_con = datong_con.append("div").classed("ps_con", true);
        var tj_select = ps_con.append("div").classed("tj_select", true).style({
        });
        var tj_con = tj_select.append("div").classed("div_input div_input2", true);
        var label = tj_con.append("label");
        var textarea = $("<textarea></textarea>").attr("rows", "5");
        $(tj_con.node()).append(textarea);
        var commonLanguage = label.append("button").classed("commonLanguage", true).style({
        }).html("常用语句");
        commonLanguage.on(touch_e, function () {
            if ($(this).css("opacity") == "0")
                return;
            if (Flag)
                return;

            Flag = true;
            setTimeout(function () {
                Flag = false;
            }, 500);
            me.Language();
        });
        datong_con.append("div").classed("report_title", true).html("选择签批人").style({
            "text-align": "center"
        });
        var dist = 285;
        var list = datong_con.append("div").classed("list", true).style({
            width: "100%",
            height: (height - dist) + "px",
            "over-follow": "hidden",
            "margin": "0 auto"
        }).attr("id", "list");
        var table = list.append("div").style({
            display: "table",
            width: "100%"
        }).attr("cellpadding", "0").attr("cellspacing", "0");
        listTable(table); // 选择人员列表
        function listTable(table) {
            var menber = me.btnRoles
            console.log(menber);
            var tr1 = table.append("div").classed("sjr_name", true);
            var ul = tr1.append("ul");
            for (var party in menber) {
                var li = ul.append("li").attr("action", menber[party]["action"])
                    .attr("roleCode", menber[party]['roleCode']).attr("userName", menber[party]["roleName"]);
                li.html("<i class= choose_ico></i>" + menber[party]["roleName"]);
                li.on("click", function () {

                    if (Flag)
                        return;
                    Flag = true;
                    setTimeout(function () {
                        Flag = false;
                    }, 500);
                    $("li").removeClass("sel1");
                    $(this).addClass("sel1");
                    d3.selectAll("i").classed("choosed_ico", false).classed("choose_ico", true);
                    d3.select(this).select("i").classed("choosed_ico", true).classed("choose_ico", false);
                    me.roleCode = $(this).attr("roleCode");
                });
            }
        };
        var tj_button = datong_con.append("div").classed("tj_button2", true).classed("qb_btn_bg", true).style({
            bottom: "0px"
        });
        var cancel = tj_button.append("input").classed("btn_back", true).attr("type", "button")
            .attr("value", "取  消");
        var ensure = tj_button.append("input").classed("btn_agree", true).attr("type", "button")
            .attr("value", "确  认");
        // 点击取消
        cancel.on(touch_e, function () {
            if (Flag)
                return;
            Flag = true;
            setTimeout(function () {
                Flag = false;
            }, 500);
            // 退回到详细页面
            setTimeout(function () {
                select.remove();
                // Android 返回键动作更改
                Android.back = TempFunction.back1;
            }, Transiacion);
        });
        ensure.on(touch_e, function () {
            if (Flag)
                return;
            Flag = true;
            setTimeout(function () {
                Flag = false;
            }, 500);
            if (!me.roleCode.length) {
                Prompt("请选择下一位签批人", 1000);
                return;
            }
            me.wcEnsure(true);
        });
        // Android 返回键动作
        function back2() {
            $(".comList").remove();
            $(".mark").remove();

            setTimeout(function () {
                select.remove();
            }, 10);
            Android.back = TempFunction.back1;
        }

        Android.back = TempFunction.back2 = back2;
        new iScroll("list", {hScrollbar: false, vScrollbar: false}); // 滑动效果
    };
    // 外出报备，操作按钮
    // wordFlag :true 需要输入意见， false 不需要输入意见
    huiyi.prototype.nextWithWord = function (wordFlag) {
        var me = this;
        if (!wordFlag) {
            /* me.wcEnsure(wordFlag);
             return;*/
            navigator.notification.confirm(me.btnName + "?", showConfirm, 'OA', ['取消', '确定']);
            // 插件 ，原生弹出框
            function showConfirm(but) {
                if (but == 2) {
                    me.wcEnsure(wordFlag);
                }
            }

            return;
        }
        var d1 = this._config.body || d3.select("body");
        var select = d3.select("body").append("div").classed("select", true).style({
            width: "100%",
            height: "100%",
            background: "#fff",
            position: "absolute",
            left: "0px",
            top: "0px",
            "z-index": 1000,
            "over-follow": "hidden"
        });

        var dt_warp = select.append("div").classed("dt_warp", true);
        var head = dt_warp.append("div").classed("datong_header", true);

        var back = head.append("div").classed("go_back", true);
        back.html("<i><img src =../../common/page/images/go_back_ico.png width =16 height=auto></i>返回");
        back.on(touch_s, function () {
            $(this).css("background-color", "#005ebf");
        });
        // 左上角返回按钮 动作
        back.on(touch_e, function () {
            $(this).css("background-color", "");

            setTimeout(function () {
                select.remove();
                // Android返回键动作更改
                Android.back = TempFunction.back1;
            }, 10);
        });
        // Android 返回键动作
        function back2() {
            $(".comList").remove();
            $(".mark").remove();

            setTimeout(function () {
                select.remove();
            }, 10);
            Android.back = TempFunction.back1;
        }

        Android.back = TempFunction.back2 = back2;
        var datong_con = dt_warp.append("div").classed("datong_con", true).style({
            height: (height - 44) + "px",
            background: "#fff"
        });
        var dist = 122
        if (wordFlag) {
            var ps_con = datong_con.append("div").classed("ps_con", true);
            var tj_select = ps_con.append("div").classed("tj_select", true).style({
            });
            var tj_con = tj_select.append("div").classed("div_input div_input2", true);
            var label = tj_con.append("label");
            var textarea = $("<textarea></textarea>").attr("rows", "5");
            $(tj_con.node()).append(textarea);
            var commonLanguage = label.append("button").classed("commonLanguage", true).style({
            }).html("常用语句");
            commonLanguage.on(touch_e, function () {
                if ($(this).css("opacity") == "0")
                    return;
                if (Flag)
                    return;

                Flag = true;
                setTimeout(function () {
                    Flag = false;
                }, 500);
                me.Language();
            });
        }

        var tj_button = datong_con.append("div").classed("tj_button2", true).classed("qb_btn_bg", true).style({
            bottom: "0px"
        });
        var cancel = tj_button.append("input").classed("btn_back", true).attr("type", "button")
            .attr("value", "取  消");
        var ensure = tj_button.append("input").classed("btn_agree", true).attr("type", "button")
            .attr("value", "确  认");
        // 点击取消
        cancel.on(touch_e, function () {
            if (Flag)
                return;
            Flag = true;
            setTimeout(function () {
                Flag = false;
            }, 500);
            // 退回到详细页面

            setTimeout(function () {
                select.remove();
                // Android 返回键动作更改
                Android.back = TempFunction.back1;
            }, Transiacion);
        });
        ensure.on(touch_e, function () {
            if (Flag)
                return;
            Flag = true;
            setTimeout(function () {
                Flag = false;
            }, 500);
            me.wcEnsure(wordFlag);
        });

    };// 向后台提交操作结果
    huiyi.prototype.wcEnsure = function (wordFlag) {
        var me = this;
        var d1 = this._config.body || d3.select("body");
        var render = this._config.render || d3.select("body");
        if (wordFlag) {
            if (!$("textarea").val().length) {
                Prompt("请输入意见", 1000);
                return;
            }
        }


        var url = serverURL + "cmcp/goutapply/btnClickBusiness";
        var self = {
            id: me._id,
            type: me.type,
            btnCode: me.btnCode,
            btnParam: me.btnParam,
            targetStep: me.targetStep,
            roleCode: me.roleCode,
            message: $("textarea").val() || ""
        };
        console.log(url, self);
        PostCP(url, self, function (dat) {
            if (!dat) {
                Prompt("提交失败");
                return;
            }
            if (dat == "success") {
                Prompt("提交成功")
            } else {
                console.log(dat);
                Prompt("成功分发给" + dat.split(" ").join("<br>"));
            }

            setTimeout(function () {
                d3.select(".select").remove();
            }, 10);
            setTimeout(function () {
                d3.selectAll("#scrol").remove();
                // Android返回键动作更改并重新刷新待办列表
                window.localStorage.status = "true";
                Android.back = TempFunction.back;
            }, 0);
        }, function () {
            Prompt("提交失败")
        });
    };
    /*************************
     *   以上为外出报备增加操作按钮部分
     *
     *
     *
     * */

        // 会议纪要，呈报，议题等操作按钮
    huiyi.prototype.showButton = function () {
        var me = this;
        var button = me.button;
        // modify 2014-12-29 获取 meetType
        var meetType = me.getType("meetType");
        me._meetType = meetType;
        // modify 2014-12-29 获取 meetType

        if (!button || !button["button"])
            return;
        var buttons = button["button"];
        var warp = d3.select("#scrol .dt_warp");
        var button = warp.append("div").classed("tj_button2", true).classed("qb_btn_bg", true);
        var tj_button = button.append("p").style({
            "text-align": "center"
        });
        for (var name in buttons) {
            var Action = buttons[name]["name"] || "";
            // 2014-12-29 隐藏相应操作按钮
            if (me._businessType == "0023") {
                if (me._userTask == "usertask13") {
                    if (me._meetType == "0003"||me._meetType == "0005") {
                        if (buttons[name]["action"] == "flow59") {
                            continue;
                        }
                    }
                    else {
                        if (buttons[name]["action"] == "flow58") {
                            continue;
                        }
                    }

                }
                /*if (me._userTask == "usertask11") {
                    if (me._meetType != "0003" && buttons[name]["action"] == "flow74") {
                        continue
                    }
                } */ // modify 2014-12-29 隐藏相应操作按钮
            }

            if (Action.indexOf("退回") > -1) {
                var input = tj_button.append("input").classed("btn_back", true)
                    .attr("action", buttons[name]["action"] || "")
                    .attr("type", "button")
                    .attr("mark", buttons[name]["mark"])
                    .attr("requestUrl", buttons[name]["requestUrl"])
                    .attr("value", "退 回");
            } else if (Action.indexOf("办结") > -1) {
                var input = tj_button.append("input").classed("other", true)
                    .attr("action", buttons[name]["action"] || "")
                    .attr("type", "button")
                    .attr("mark", buttons[name]["mark"])
                    .attr("requestUrl", buttons[name]["requestUrl"])
                    .attr("value", buttons[name]["name"]);
            } else if (Action.indexOf("完成") > -1) {
                var input = tj_button.append("input").classed("btn_agree", true)
                    .attr("action", buttons[name]["action"] || "")
                    .attr("type", "button")
                    .attr("mark", buttons[name]["mark"])
                    .attr("requestUrl", buttons[name]["requestUrl"])
                    .attr("value", buttons[name]["name"]);
            } else if (Action.indexOf("作废") > -1) {
                var input = tj_button.append("input").classed("drop", true)
                    .attr("action", buttons[name]["action"] || "")
                    .attr("type", "button")
                    .attr("mark", buttons[name]["mark"])
                    .attr("requestUrl", buttons[name]["requestUrl"])
                    .attr("value", "作 废");
            } else if (Action.indexOf("确认收文") > -1) {
                var input = tj_button.append("input").classed("confirms", true)
                    .attr("action", buttons[name]["action"] || "")
                    .attr("type", "button")
                    .attr("mark", buttons[name]["mark"])
                    .attr("requestUrl", buttons[name]["requestUrl"])
                    .attr("value", buttons[name]["name"]);

            } else {
                if (buttons[name]["name"].length == 3) {
                    var btn_agree = "btn_agree";
                }
                else if (buttons[name]["name"].length == 4) {
                    var btn_agree = "confirms";
                }
                else {
                    var btn_agree = "other";
                }
                var input = tj_button.append("input").classed(btn_agree, true).classed("next", true)
                    .attr("action", buttons[name]["action"] || "")
                    .attr("type", "button")
                    .attr("mark", buttons[name]["mark"])
                    .attr("requestUrl", buttons[name]["requestUrl"])
                    .attr("value", buttons[name]["name"]);
                //  console.log(buttons[name]["userInfo"]);

            }
            $(input.node()).data("key", buttons[name]["userInfo"]);
        }
        if ($(".tj_button2 p input").length <= 0) {
            $(".tj_button2").remove();
            $("#scrol_").css({
                height: height - 44 + "px"
            });
        }
        if ($(".tj_button2 p input").length <= 2) {
            $(".tj_button2 p input").css({
                width: "40%"
            });
        }
        if ($(".tj_button2 p input").length === 3) {
            $(".tj_button2 p input").css({
                width: "26.1%"
            });
        }
        if ($(".tj_button2 p input").length === 4) {
            $(".tj_button2 p input").css({
                width: "20%"
            });
        }
        me.buttonClick();
    };
    // 操作按钮点击事件
    huiyi.prototype.buttonClick = function () {
        var me = this;
        $("input").on("click", function () {
            if (Flag)
                return
            Flag = true;
            setTimeout(function () {
                Flag = false
            }, 500);
            //    console.log($(this).data());
            me._requestUrl = $(this).attr("requestUrl") || "";
            var mark = $(this).attr("mark") || "false";
            me._mark = mark;
            var userInfo = $(this).data("key") || null;
            me._userInfo = userInfo;
            var action = $(this).attr("action") || "";
            me._action = action;
            var value = $(this).val() || "";
            me._value = value;
            console.log(me);

            if (!objectJudge(userInfo) && mark != "true") {
                if (mark != "false"){
					me._mark = mark;
				}else{
					me._mark = null;
				}
                me.dialog();
            }
            else {
                if (mark != "true" && mark != "false")
                    me._mark = mark;
                me.showNext();
            }
        });
    };
    //  按钮操作的界面
    huiyi.prototype.showNext = function () {
        var me = this;
        var d1 = this._config.body || d3.select("body");
        var select = d3.select("body").append("div").classed("select", true).style({
            width: "100%",
            height: "100%",
            background: "#fff",
            position: "absolute",
            left: "0px",
            top: "0px",
            "z-index": 1000,
            "over-follow": "hidden"
        });

        var dt_warp = select.append("div").classed("dt_warp", true);
        var head = dt_warp.append("div").classed("datong_header", true);

        var back = head.append("div").classed("go_back", true);
        back.html("<i><img src =../../common/page/images/go_back_ico.png width =16 height=auto></i>返回");
        back.on(touch_s, function () {
            $(this).css("background-color", "#005ebf");
        });
        // 左上角返回按钮 动作
        back.on(touch_e, function () {
            $(this).css("background-color", "");

            setTimeout(function () {
                select.remove();
                // Android返回键动作更改
                Android.back = TempFunction.back1;
            }, 10);
        });
        if (me._userInfo) {
            head.append("h1").html(me._taskName);
        }
        else {
            head.append("h1").html(me._taskName);
        }
        var datong_con = dt_warp.append("div").classed("datong_con", true).style({
            height: (height - 44) + "px",
            background: "#fff"
        });
        var dist = 122
        if (me._mark == "true") {
            var dist = 285
            var ps_con = datong_con.append("div").classed("ps_con", true);
            var tj_select = ps_con.append("div").classed("tj_select", true).style({
            });
            var tj_con = tj_select.append("div").classed("div_input div_input2", true);
            var label = tj_con.append("label");
            var textarea = $("<textarea></textarea>").attr("rows", "5");
            $(tj_con.node()).append(textarea);
            var commonLanguage = label.append("button").classed("commonLanguage", true).style({
            }).html("常用语句");
            commonLanguage.on(touch_e, function () {
                if ($(this).css("opacity") == "0")
                    return;
                if (Flag)
                    return;

                Flag = true;
                setTimeout(function () {
                    Flag = false;
                }, 500);
                me.Language();
            });
        }
// 需要选择下一位收件人
        if (me._userInfo && objectJudge(me._userInfo)) {
            //     console.log(me._userInfo);
            datong_con.append("div").classed("report_title", true).html("选择收件人").style({
                "text-align": "center"
            });
            var list = datong_con.append("div").classed("list", true).style({
                width: "100%",
                height: (height - dist) + "px",
                "over-follow": "hidden",
                "margin": "0 auto"
            }).attr("id", "list");
            var table = list.append("div").style({
                display: "table",
                width: "100%"
            }).attr("cellpadding", "0").attr("cellspacing", "0");
            listTable(table);
            function listTable(table) {
                var menber = me._userInfo;
                console.log(menber);
                for (var party in menber) {
                    if (!menber[party].length)
                        continue;
                    var tr = table.append("div").classed("sjt_tit", true).html(party);
                    var tr1 = table.append("div").classed("sjr_name", true);
                    var ul = tr1.append("ul");
                    for (var j = 0; j < menber[party].length; j++) {
                        var li = ul.append("li").attr("action", menber[party][j]["action"])
                            .attr("roleCode", menber[party][j]['roleCode']).attr("userName", menber[party][j]["userName"]);
                        li.html("<i class= choose_ico></i>" + menber[party][j]["userName"]);
                        li.on("click", function () {
                            if (Flag)
                                return;
                            Flag = true;
                            setTimeout(function () {
                                Flag = false;
                            }, 500);
                            $("li").removeClass("sel1");
                            $(this).addClass("sel1");
                            d3.selectAll("i").classed("choosed_ico", false).classed("choose_ico", true);
                            d3.select(this).select("i").classed("choosed_ico", true).classed("choose_ico", false);
                        });
                    }

                }
            };
            new iScroll("list", {hScrollbar: false, vScrollbar: false});

        }
        var tj_button = datong_con.append("div").classed("tj_button2", true).classed("qb_btn_bg", true).style({
            bottom: "0px"
        });
        var cancel = tj_button.append("input").classed("btn_back", true).attr("type", "button")
            .attr("value", "取  消");
        var ensure = tj_button.append("input").classed("btn_agree", true).attr("type", "button")
            .attr("value", "确  认");

        //提交操作结果
        ensure.on(touch_e, function () {
            if (Flag)
                return;
            Flag = true;
            setTimeout(function () {
                Flag = false;
            }, 500);
            me.ensure();
        });
        // 点击取消
        cancel.on(touch_e, function () {
            if (Flag)
                return;
            Flag = true;
            setTimeout(function () {
                Flag = false;
            }, 500);
            // 退回到详细页面

            setTimeout(function () {
                select.remove();
                // Android 返回键动作更改
                Android.back = TempFunction.back1;
            }, Transiacion);
        });

        // Android 返回键动作
        function back2() {
            $(".comList").remove();
            $(".mark").remove();

            setTimeout(function () {
                select.remove();
            }, 500);
            Android.back = TempFunction.back1;
        }

        Android.back = TempFunction.back2 = back2;
    };
    // 向后台提交操作结果
    huiyi.prototype.ensure = function () {
        var me = this;
        var d1 = this._config.body || d3.select("body");
        var render = this._config.render || d3.select("body");
        if (me._mark == "true" && (!$("textarea").val().length)) {
            Prompt("请输入意见", 1000);
            return;
        }
        var approvalFlag = me._action, roleCodes = "", userName = "";
        var roleCodesFlag = roleCodes
        if (me._userInfo && objectJudge(me._userInfo)) {
            $(".sjr_name ul li").each(function () {
                if ($(this).hasClass("sel1")) {
                    if ($(this).attr("action")) {
                        approvalFlag = $(this).attr("action");
                    }

                    roleCodes = $(this).attr("roleCode");
                    userName = $(this).attr("userName");
                    roleCodesFlag = roleCodes
                }
            });
        } else {
            roleCodesFlag = true;
        }

        console.log(approvalFlag, roleCodes);
        if (!approvalFlag || !roleCodesFlag) {
            Prompt("请选择下一位收件人！", 1000);
            return;
        }
        var textMark = "";
        if (me._mark != "true" && me._mark != "false") {
            textMark = me._mark
        }
        else {
            textMark = $("textarea").val()
        }
        var url = serverURL + "cmcp/phone/approvalInfo";

        var self = {
            approvalFlag: approvalFlag,
            taskId: me._taskId,
            id: me._id,
            businessType: me._businessType,
            type: me._type,
            requestUrl: me._requestUrl || null,
            roleCodes: roleCodes,
            mark: textMark
        };
        console.log(self);
        // 向后台提交选择的下一位收件人信息
        window.plugins.getIntent.show(["OA", "正在提交."])
        PostCP(url, self, function (data, status) {
            window.plugins.getIntent.hide();
            console.log(data);
            if (!data) {
                Prompt("操作失败，请重新登录。", 1000);
                return;
            }
            if (data == "hadHand") {
                Prompt("该文件已被处理！", 1000);
                return;
            }
            if (userName && userName.length) {
                Prompt("成功提交给</br>" + userName, 1000);
            }
            else {
                Prompt("操作成功", 1000);
            }

            // 退回到待办列表

            setTimeout(function () {
                d3.select(".select").remove();
            }, 10);
            setTimeout(function () {

                setTimeout(function () {
                    d3.selectAll("#scrol").remove();
                }, Transiacion);
                // Android返回键动作更改并重新刷新待办列表
                window.localStorage.status = "true";
                Android.back = TempFunction.back;
            }, 0);
        }, function () {
            window.plugins.getIntent.hide();
            Alert("提交失败！");

        });
    };
    // 不需要输入意见，也不需要选择下一位收件人，直接弹出原生提示框
    huiyi.prototype.dialog = function () {
        var me = this;
        //    me.confirm();
        // 2015-1-22 弹出描述显示问题 bug1477
        navigator.notification.confirm('您确定要' + me._value.replace(/[ ]/g,"") + '文件么？', showConfirm, 'OA', ['取消', '确定']);
        function showConfirm(button) {
            if (button == 2) {
                me.confirm();
            }
        }
    };
    // 向后台提交操作结果
    huiyi.prototype.confirm = function () {
        var me = this;
        var d1 = this._config.body || d3.select("body");
        var render = this._config.render || d3.select("body");
        var url = serverURL + "cmcp/phone/approvalInfo";
        var self = {
            approvalFlag: me._action,
            taskId: me._taskId,
            id: me._id,
            businessType: me._businessType,
            requestUrl: me._requestUrl || null,
            type: me._type,
            roleCodes: null,
            mark: me._mark || ""
        };
        // 向后台提交内容
        console.log(self);
        window.plugins.getIntent.show(["OA", "正在提交"])
        PostCP(url, self, function (data, status, e) {
            console.log(data);
            window.plugins.getIntent.hide();
            if (!data) {
                Prompt("操作失败，请重新登录。", 1000);
                return;
            }
            if (data != "success") {
                Prompt("该文件已被处理！", 1000);
                return;
            }

            Prompt("操作成功！", 1000);
            // 成功后返回待办列表
            setTimeout(function () {


                setTimeout(function () {
                    d3.selectAll("#scrol").remove();
                    Android.back = TempFunction.back;
                }, Transiacion);
                window.localStorage.status = "true";
            }, 1000);
        }, function () {
            // 失败显示提示信息
            window.plugins.getIntent.hide();
            Prompt("操作失败，请重新登录。", 1000);
        });
    };
    // 会议展示详细信息
    huiyi.prototype.meetContent = function () {
        var me = this;
        var content = me.dat;
        var warp = d3.select("#scrol .dt_warp");
        var disTant = 100;
        if (me._buttonFlag)
            disTant = 44;
        var scrol_ = warp.append("div").classed("scrol_", true).style({
            width: "100%",
            height: height - disTant + "px",
            postion: "relative",
            overflow: "hidden"
        }).attr("id", "scrol_");
        var datong_con = scrol_.append("div").classed("datong_con datong_con_re", true);
        var datong_con = datong_con.append("div").classed("phone_cotent", true);
        var ul = datong_con.append("ul");
        var li = ul.append("li").classed("b_btm", true).style({
            width: "100%"
        });
        var table = li.append("table").attr("cellpadding", "0").attr('cellspacing', "0").style({
            width: "100%"
        });
        if (me._from != "zfwj") {
            var li1 = datong_con.append("div").style({
                width: "100%"
            });
        }

        for (var index in content) {

            if (index.indexOf("附件") > -1) {
                continue;
            }
            if (index.indexOf("正文") > -1) {
                continue;
            }
            if (index.indexOf("议题") > -1) {
                me._yiti = index;
                continue;
            }
            var tdName = "";


            tdName = index.split("").join("&nbsp");


            if (typeof(content[index]) == "string" || typeof(content[index]) == "number") {
                if (!content[index].length)
                    continue;

                var tr = table.append("tr");
                tr.append("td").html("<div>" + tdName + "</div>").style({
                    width: "25%"
                });
                tr.append("td").style({
                    width: "75%"
                }).append("div").html(content[index]).classed("extend", true);
            }
            else {
                if (me._from == "zfwj") {
                    continue;
                }
                var qq = "";
                if (!content[index] || !content[index].length)
                    continue;
                var title = li1.append("div").classed("report_title", true).html(index);

                for (var j = 0; j < content[index].length; j++) {
                    if (!j)
                        qq += content[index][j];
                    else {
                        qq += "</br>" + content[index][j];
                    }
                }
                var ul = li1.append("ul");
                var li = ul.append("li").classed("b_btm", true).style({
                    padding: "5px 0px"
                });
                var dl = li.append("dl");
                dl.append("dd").html(qq);
            }

        }
        if (content[me._yiti] && content[me._yiti].length)
            var datong_con = d3.select(".datong_con_re").append("div").classed("phone_cotent", true);
        if (content[me._yiti] && content[me._yiti].length) {
            var temp = content[me._yiti];
            console.log(temp);
            var fileList = datong_con.append("div").classed("report_title", true).html("议题");
            if (typeof (temp) == "string" || typeof (temp) == "number") {
                var ul = datong_con.append("ul");
                var li = ul.append("li").classed("b_btm", true).style({
                    padding: "5px 0px"
                });
                var dl = li.append("dl");
                dl.append("dd").html(temp);
            }
            else {
                for (var j = 0; j < temp.length; j++) {
                    var ul = datong_con.append("ul");
                    var li = ul.append("li").classed("b_btm", true).style({
                        width: "100%"
                    });

                    if (temp[j]["title"] && temp[j]["title"].length) {
                        var table = li.append("table").attr("cellpadding", "0").attr('cellspacing', "0").style({
                            width: "100%"
                        });
                        var tr = table.append("tr");
                        tr.append("td").html("<div>标&nbsp题</div>").style({
                            "width": "25%"
                        });
                        tr.append("td").style({
                            "width": "75%"
                        }).append("div").html(temp[j]["title"]).classed("extend", true);
                        if (temp[j]["content"] && temp[j]["content"].length) {
                            var tr = table.append("tr");
                            tr.append("td").html("<div>内&nbsp容</div>").style({
                                "width": "25%"
                            });
                            tr.append("td").style({
                                "width": "75%"
                            }).append("div").html(temp[j]["content"]).classed("extend", true);

                        }
                        if (temp[j]["attachment"] && temp[j]["attachment"].length) {
                            var fileList = datong_con.append("div").classed("report_title", true).html("附件:");
                            var contentT = temp[j]["attachment"]
                            for (var i = 0; i < contentT.length; i++) {
                                if (!contentT[i]["name"])
                                    continue;
                                var newDiv = datong_con.append("div").classed("newDiv", true)
                                    .attr("url", contentT[i]["pdfUrl"]).attr("fileName", contentT[i]["name"]);
                                var len = contentT[i]["pdfUrl"].split(".").length;
                                var extend = contentT[i]["pdfUrl"].split(".")[len - 1];
                                var img = newDiv.append("img").attr("src", "../../common/page/images/" + extend + ".png").attr({
                                    width: "25",
                                    height: "22"

                                }).style("margin-left", "15px");
                                var gragh = newDiv.append("p").html(contentT[i]["name"])
                                    .attr("url", contentT[i]["pdfUrl"]).attr("fileName", contentT[i]["name"]);
                                // 打开正文附件
                                newDiv.on("click", function () {
                                    if (Flag)
                                        return;
                                    Flag = true;
                                    setTimeout(function () {
                                        Flag = false;
                                    }, 500);
                                    var url = $(this).attr("url");
                                    var fileName = $(this).attr("fileName");
                                    url = serverURL + url.substr(1);
                                    //  Alert(url);
                                    window.openF(url, fileName);
                                });
                            }
                        }

                    }
                }
            }

        }
        if (content["正文"] && content["正文"].length) {
            var fileList = datong_con.append("div").classed("report_title", true).html("正文:");

            var newDiv = datong_con.append("div").classed("newDiv", true)
                .attr("url", content["正文"]).attr("fileName", "正文");
            var len = content["正文"].split(".").length;
            var extend = content["正文"].split(".")[len - 1];
            var img = newDiv.append("img").attr("src", "../../common/page/images/" + extend + ".png").attr({
                width: "25",
                height: "22"

            }).style("margin-left", "15px");
            var gragh = newDiv.append("p").html("正文")
                .attr("url", content["正文"]).attr("fileName", "正文");
            // 打开正文附件
            newDiv.on("click", function () {
                if (Flag)
                    return;
                Flag = true;
                setTimeout(function () {
                    Flag = false;
                }, 500);
                var url = $(this).attr("url");
                var fileName = $(this).attr("fileName");
                url = serverURL + url.substr(1);
                //   Alert(url);
                window.openF(url, fileName);
            });

        }
        if (content["附件"] && content["附件"].length) {
            var fileList = datong_con.append("div").classed("report_title", true).html("附件");
            for (var i = 0; i < content["附件"].length; i++) {
                if (!content["附件"][i]["name"])
                    continue;
                var newDiv = datong_con.append("div").classed("newDiv", true)
                    .attr("url", content["附件"][i]["url"]).attr("fileName", content["附件"][i]["name"]);
                ;
                var len = content["附件"][i]["url"].split(".").length;
                var extend = content["附件"][i]["url"].split(".")[len - 1];
                var img = newDiv.append("img").attr("src", "../../common/page/images/" + extend + ".png").attr({
                    width: "25",
                    height: "22"

                }).style("margin-left", "15px");
                var gragh = newDiv.append("p").html(content["附件"][i]["name"])
                    .attr("url", content["附件"][i]["url"]).attr("fileName", content["附件"][i]["name"]);
                // 打开正文附件
                newDiv.on("click", function () {
                    if (Flag)
                        return;
                    Flag = true;
                    setTimeout(function () {
                        Flag = false;
                    }, 500);
                    var url = $(this).attr("url");
                    var fileName = $(this).attr("fileName");
                    url = serverURL + url.substr(1);
                    //      Alert(url);
                    window.openF(url, fileName);
                });
            }
        }
        /*
         流程跟踪
         */
        if (me._from != "zfwj") {
            var report_title = d3.select(".datong_con_re").append("div").classed("report_title", true).html("流程跟踪");
            report_title.style({
                background: "#f2f2f0",
                color: "#2345e6",
                "border-radius": "10px",
                "margin": "0% 2% 2% 2%"
            })
            report_title.on("click", function () {
                if (Flag)
                    return;
                Flag = true;
                me.openNew();

                setTimeout(function () {
                    Flag = false;
                }, 500);
            });
        }

        new iScroll("scrol_", {hScrollbar: false, vScrollbar: false});
        window.plugins.getIntent.hide();
    };
    // 常用语列表
    huiyi.prototype.Language = function () {
        var me = this;
        var value = $("textarea").val();
        var dat = me.languages;
        if (!dat["languages"] || !dat["languages"].length) {
            Alert("您还没有常用语句，请到后台维护您的常用语");
            return;
        }
        comList = dat["languages"] || comList;
        var List = d3.select("body").append("div").classed("comList", true);
        var head = List.append("div").classed("head", true).html("常用语列表");
        var con = List.append("div").classed("con", true).attr("id", "comList").style({
            "border-radius": "3px",
            background: "#ccdfee"
        });
        var ul = con.append("ul").style("overflow", "hidden").style({
            width: "80%",
            position: "absolute",
            left: "10%"
        });
        ul.append("li").style({
            height: "10px",
            "border-bottom": ".4px solod #838383"
        });
        for (var i = 0; i < comList.length; i++) {
            ul.append("li").html("<img src=../../common/page/images/mr.png>  " + comList[i]);

        }
        ul.append("li").style({
            height: "10px",
            "border-bottom": ".4px solod #838383"
        });
        new iScroll("comList", {hScrollbar: false, vScrollbar: false});
        var html = "";
        $(".comList ul li").each(function () {
            $(this).on("click", function () {
                if (Flag)
                    return;
                Flag = true;
                setTimeout(function () {
                        Flag = false;
                    },
                    500
                )
                $(this).toggleClass("selec");
                var that = d3.select(this);
                if ($(this).hasClass("selec")) {
                    html += $(this).text() + " ";
                    that.select("img").attr("src", "../../common/page/images/xz.png");
                } else {
                    html = html.replace($(this).text() + " ", "");
                    that.select("img").attr("src", "../../common/page/images/mr.png");
                }
                $("textarea").val(value + html);

            });
        });
        var but = List.append("div").classed("but", true);
        var p = but.append("p").style({
            background: '#afbcca'
        });
        var but2 = p.append("button").style({
            width: "100px",
            height: "35px",
            background: "#d76856",
            color: "#ffe",
            "border-radius": "7px",
            "font-size": "18px",
            "margin": "10px"
        }).html("取 消");
        var but1 = p.append("button").style({  // 这里应该把样式写到 css 里
            width: "100px",
            height: "35px",
            border: '0px solid #70ab67',
            background: '#65d756',
            color: "#ffe",
            "border-radius": "7px",
            "font-size": "18px",
            "margin": "10px"
        }).html("确 认");

        but1.on("click", function () {
            Flag = true;
            List.remove();

            setTimeout(function () {
                Flag = false;
            }, 1000);

        });

        but2.on("click", function () {
            Flag = true;
            List.remove();

            $("textarea").val(value);
            setTimeout(function () {
                Flag = false;
            }, 1000);

        });


    };
    huiyi.prototype.openNew = function () {
        var me = this;
        var href = location.href;
        var len = href.lastIndexOf("/");
        var url = href.substr(0, len - 4) + "lcgz/lcgz.html?id=" + me._id + "&businessType=" + me._businessType + "&screenindex=" + me._screenindex;
        window.openViewC(url);
    };
    huiyi.prototype.getConfig = function (key) {
        if (this._config == null) {
            return null;
        } else {
            if (typeof (this._config[key]) != "undefined") {
                return this._config[key];
            } else {
                return null;
            }
        }
    };
})();